package com.linkoog.devtools.code_generator.wizard.generate.database.table.model.schema;

import javax.swing.*;
import java.awt.*;

public class SchemaComboBoxCellRender implements ListCellRenderer {

    private JLabel label;


    public SchemaComboBoxCellRender() {
        label = new JLabel();
        label.setOpaque(true);
    }

    @Override
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        if (value == null) {
            label.setText("");
            return label;
        }

        if (value instanceof String){
            String schema = (String)value;
            label.setText(schema);
        }

        return label;
    }
}
